/**
 * 
 */
package com.huarui.component.action;


import java.util.Map;

import org.apache.struts2.ServletActionContext;
import org.ewaf.framework.model.PagingInfo;
import com.huarui.component.service.LookupCompanyService;
import com.huarui.component.service.TipsDataQuerier;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;

/**
 * @author peng.sunp
 *
 */
public class CompanyAutotipsorAction extends AbstractAutotipsorAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9091516036649855392L;
    private PagingInfo<String, Map<String, Object>> paginInfo;
	private TipsDataQuerier companyTipsDataQuerier;
	private LookupCompanyService lookupCompanyService;
	
	public String input() throws Exception{
		return Action.SUCCESS;
	}
	public String execute() throws Exception
	{
		this.paginInfo=new PagingInfo<String, Map<String, Object>>();
		paginInfo.setCondition(this.keyword);
		paginInfo.setStart((this.page-1)*this.size);
		paginInfo.setLimit(this.size);
		this.lookupCompanyService.queryCompanys(paginInfo);

		
		ActionContext context = ServletActionContext.getContext();
		context.put("companys", paginInfo.getItems());
		context.put("pagingInfo", paginInfo.getSummary());
		
		//this.list=companyTipsDataQuerier.queryTipsData(this.q, this.limit);
		return Action.SUCCESS;
	}
	/* (non-Javadoc)
	 * @see com.huarui.component.action.AbstractAutotipsorAction#getJsonResult()
	 */
	@Override
	public PagingInfo<String,Map<String, Object>> getJsonResult() {
		return this.paginInfo;
	}
	public void setCompanyTipsDataQuerier(TipsDataQuerier companyTipsDataQuerier) {
		this.companyTipsDataQuerier = companyTipsDataQuerier;
	}
	
	public void setLookupCompanyService(LookupCompanyService lookupCompanyService) {
		this.lookupCompanyService = lookupCompanyService;
	}
	public void setPage(int page) {
		this.page = page;
	}

}
